home *** CD-ROM | disk | FTP | other *** search
- Path: gwen.pcug.co.uk!altheim!broldham
- Newsgroups: comp.lang.c
- Message-ID: <1245@altheim.win-uk.net>
- References: <1239@altheim.win-uk.net><18MAR199607594276@erich.triumf.ca> <1242@altheim.win-uk.net><314EC8E6.216E@ix.netcom.com>
- Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
- From: broldham@altheim.win-uk.net (Brian R. Oldham)
- Date: Wed, 20 Mar 1996 17:51:39 GMT
- Subject: Re: Pointers to register
-
-
- In article <314EC8E6.216E@ix.netcom.com>, Norman Bullen (nbullen@ix.netcom.com) writes:
- >Brian R. Oldham wrote:
- >>
- >>
- >> OK Point taken. But it still leaves the question why my compiler
- >> (B.Turbo C/C++ v3.0) accepts the above code, but complains at:
- >>
- >> scancode = &outregs.h.ah;
- >>
- >>
- >> ---
- >> Brian Oldham
- >> Hucknall UK
- >> !...Gesundbrunnen
- >scancode is a pointer to an int. &outregs.h.ah is a pointer to something
- >that is not an int; most likely a pointer to an unsigned char. The
- >compiler is right to complain about assigning one kind of pointer to
- >another.
- >
- >
-
- You are quite right. I checked in dos.h (BYTEREGS) and al, ah etc. are
- all unsigned char. So today I went back to my program and changed the
- declaration of scancode from pointer to int to a pointer to unsigned
- char. Sure enough, my program compiled without complaint, but - guess
- what - when I ran it in a main() the bloody system froze.
-
- So back to my original question: why does the ostensibly incorrect
- declaration:
-
- *ptr = union_member_var;
-
- work, and the correct:
-
- ptr = &union_member_var;
-
- does not?
-
-
-
- ---
- Brian Oldham
- Hucknall UK
- !...Gesundbrunnen
-
-
-
-
-
-
-
-
-